//
//  KLNormalCollectionViewCell.m
//  KunLun
//
//  Created by Mac on 2017/11/27.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "KLNormalCollectionViewCell.h"

#define imageWith (UIScreenWidth / 2 - 15)

@interface KLNormalCollectionViewCell()
@property(nonatomic, strong) UIImageView     *iconImageView;
@property(nonatomic, strong) STLabel         *titleLable;
@property(nonatomic, strong) STButton        *priceButton;
@property(nonatomic, strong) STButton        *originPriceButton;
@property(nonatomic, strong) STLabel         *numLable;
@end

@implementation KLNormalCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self configSubView];
    }
    return self;
}
#pragma mark --SubView
- (void)configSubView{
    UIColor * textColor = UIColorFromRGBA(0x616161);
    UIView * whiteView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth / 2 - 15, 230)];
    whiteView.backgroundColor = [UIColor whiteColor];
    whiteView.layer.cornerRadius = 5;
    whiteView.clipsToBounds = YES;
    [self addSubview:whiteView];
    
    self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, imageWith, 130)];
    self.iconImageView.image = [UIImage imageNamed:@"05"];
    [self.iconImageView st_showBottomLineAndWitdh:self.iconImageView.st_width - 20];
    [whiteView addSubview:self.iconImageView];
    
    self.titleLable = [[STLabel alloc] initWithFrame:CGRectMake(10, self.iconImageView.st_bottom + 1, imageWith - 20, 34)
                                                text:@"果园鲜鸡蛋"
                                           textColor:textColor
                                                font:13
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];
    self.titleLable.numberOfLines = 0;
    [whiteView addSubview:self.titleLable];
    
    self.priceButton = [[STButton alloc] initWithFrame:CGRectMake(10, self.titleLable.st_bottom + 10, imageWith - 20, 18)
                                                 title:@"渠道商家￥567"
                                            titleColor:[UIColor redColor]
                                             titleFont:13
                                          cornerRadius:0
                                       backgroundColor:nil
                                       backgroundImage:nil
                                                 image:[UIImage imageNamed:@""]];
    // self.priceButton.titleEdgeInsets  =UIEdgeInsetsMake(0, 5, 0, 0);
    [whiteView addSubview:self.priceButton];
    
    
    self.originPriceButton = [[STButton alloc] initWithFrame:CGRectMake(10, self.priceButton.st_bottom + 3, imageWith - 20, 18)
                                                       title:@"折扣券￥100"
                                                  titleColor:textColor
                                                   titleFont:13
                                                cornerRadius:0
                                             backgroundColor:nil
                                             backgroundImage:nil
                                                       image:[UIImage imageNamed:@""]];
    self.originPriceButton.titleEdgeInsets  = UIEdgeInsetsMake(0, 5, 0, 0);
    self.originPriceButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    self.originPriceButton.st_right = imageWith - 10;
    [whiteView addSubview:self.originPriceButton];
    
    
//    self.numLable = [[STLabel alloc] initWithFrame:CGRectMake(10, self.originPriceButton.st_bottom + 5, imageWith - 20, 30)
//                                              text:@"已卖出20件"
//                                         textColor:textColor
//                                              font:13
//                                       isSizetoFit:NO textAlignment:NSTextAlignmentRight];
//    self.numLable.st_right = self.originPriceButton.st_right;
//    [whiteView addSubview:self.numLable];
    
}
//- (void)setModel:(GHGoodModel *)model{
//    _model = model;
//    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.g_img] placeholderImage:nil];
//
//    self.titleLable.text = [NSString stringWithFormat:@"%@%@",model.g_name,model.c_name];
//
//    [self.priceButton setTitle:[NSString stringWithFormat:@"￥%@",model.i_price] forState:UIControlStateNormal];
//
//    [self.originPriceButton setTitle:[NSString stringWithFormat:@"￥%@",model.m_price] forState:UIControlStateNormal];
//    NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
//    NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"￥%@",model.m_price] attributes:attribtDic];
//    //self.originPriceButton.titleLabel.attributedText = attribtStr;
//    [self.originPriceButton setAttributedTitle:attribtStr forState:UIControlStateNormal];
//
//    self.numLable.text = [NSString stringWithFormat:@"已售出%@件",model.g_num];
//}
@end
